import { JGet, JPost } from "./axios";
import GameConst, { NPrefabKeys } from "./GameConst";

export interface PlayerGoodsVo{
    playerId?:string,
    goodsId?:number,
    goodsNum?:number,
    goodsName?:string,
    goodsPlace?:boolean,
}

//获取玩家道具
export const GetPlayerGoodsAPI = async () => (await JGet(`/world2/goods/player/goods/${GameConst.getUserId()}`)).data;

//获取玩家详细道具列表
export const GetPlayerGoodsVoAPI = async (data:PlayerGoodsVo) => (await JPost(`/world2/goods/player/goods/vo/${GameConst.getUserId()}`,data)).data;

//添加/使用 玩家道具
export const AddUsePlayerGoodsAPI = async (playerId:string,goods:NPrefabKeys,num:number) => (await JPost(`/world2/goods/player/goods/add_use`,{playerId,goodsId:goods,goodsNum:num})).data;

//获取合成方案
export const GetSynthListAPI = async () => (await JGet(`/world2/goods/synth/get`)).data;

//合成物品
export const SynthGoodsAPI = async (synthId) => (await JPost(`/world2/goods/synth/goods/${GameConst.getUserId()}/${synthId}`)).data;

